<?php
/*
 * Created on 22.12.2005
 *
 */

class c_formHandler
{

    function startElement (& $sender, $attrs)
    {
        $tag = 'print "<form';
        if (!$attrs['value'] && !$attrs['action'])
        {
            die ("Attribute value or action is missing in form tag!\n");
        }
        if ($attrs['value'])
            $tag .= ' action=\\"".'.$attrs['value'].'."\\"';
        else
            $tag .= ' action=\\"?\\"';
        if ($attrs['enctype'])
        {
            $tag .= ' enctype=\\"".'.$attrs['enctype'].'."\\"';
        }
        $tag .= ' method=\\"GET\\">";'."\n";
        if ($attrs['action'])
        {
            $tag .= 'print "<input type=\\"hidden\\" name=\\"nestedaction\\" value=\\"".'.$attrs['action'].'."\\"/>";';
        }
        $sender->appendCode($tag);
    }

    function endElement (& $sender)
    {
        $sender->appendCode('print "</form>";'."\n");
    }

}

?>